<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录界面</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>



    <script>


        // 执行登录操作（发送ajax请求，执行回调函数等等）
        $(function () {
            $("#btn").click(function () {


                    $.ajax({
                        type: "POST",
                        url: "UserServlet",
                        data: {
                            "num": $("#telephone").val(),
                            "password": $("#loginPwd").val(),
                            "method":"Login"
                        },
                        success:function(flag){
                            if(flag == false){
                                alert("您输入的用户名或密码有错！");
                            }else{
                                window.location.href = "userChoose.jsp";//跳转到主页
                            }
                        }

                    });
            });
        });
    </script>

</head>
<body>

<!--登录页面的大div-->
<div id="login-box">

    <div class="form">
        <div class="info">${error}</div>
        <h1>Login Interface</h1>

        <div class="item">
            <i class="fa fa-github-alt" style="font-size:24px"></i>
            学工号：<input type="text" name="num" id="telephone" placeholder="请输入您的学号" required>
        </div>
        <div class="item">
            <i class="fa fa-search" style="font-size:24px"></i>
            登录密码：<input type="password" name="password" id="loginPwd" placeholder="请输入您的密码" required>
        </div>

    </div>
    <span style="color: red;font-size: 12px"></span>

    <button id="btn">Login</button>
    <a href="Register.html" class="register">立即注册</a>
</div>


</body>

</html>
